<h1>Questionnaires<%= image_tag("spinner.gif",
    :align => "absmiddle",
    :border => 0,
    :id => "spinner",
    :style => "display: none;") %>
</h1>


<div id="filterBox">
  Filters (
  <a href="#" onClick="$('filterTable').show(); return false;">show</a>
  |
  <a href="#" onClick="$('filterTable').hide(); return false;">hide</a>
  )


  <div id="filterTable">
    <form id="filter_form" name="filter_form" action="">

      <hr></hr>
      <table>
        <tr>
          <th>Questionnaire</th>
          <th>Data Collection</th>
          <th>Last event</th>
        </tr>

        <tr>
          <td>
            <% QuestionnaireName.find(:all).each do |q| %>
              <ul>
                <%= check_box_tag "questionnaire[questionnaire_name_id][]", q.id %>
                <%= q.name %>
              </ul>
            <% end %>
          </td>


          <td>
            <% DataCollectionType.find(:all).each do |dc| %>
              <ul>
                <%= check_box_tag "questionnaire[data_collections.data_collection_type_id][]", dc.id %>
                <%= dc.name %>
              </ul>
            <% end %>
          </td>


          <td>
            <% QuestionnaireEventType.find(:all).each do |t| %>
              <ul>
                <%= check_box_tag "last_event[]", t.name %>
                <%= t.name %>
              </ul>
            <% end %>
          </td>

        </tr>
      </table>
    </form>
  </div>
</div>

<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
  <!--
  $('filterTable').hide();
  //-->
</SCRIPT>

<%= observe_form 'filter_form',
  :update => 'resultSet',
  :before => "Element.show('spinner')",
  :success => "Element.hide('spinner')",
  :url => {:action => 'list'},
  :with => "Form.serialize('filter_form')" %>




<div id="resultSet">
  <%= render :partial => 'questionnaires_list' %>
</div>

